<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>淘乐乐 - 购物商城</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        /* 主导航栏样式更新 */
        .main-nav {
            background: #ff3c3c;
            padding: 15px 0;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        /* 次要导航栏样式更新（原顶部导航） */
        .top-bar {
            background-color: #f8f8f8;
            padding: 8px 0;
            border-bottom: 1px solid #eee;
        }

        .top-links a {
            color: #666;
            text-decoration: none;
            margin-left: 15px;
            font-size: 14px;
            transition: color 0.3s ease;
        }

        .top-links a:hover {
            color: #ff3c3c;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 15px;
        }

        .top-bar-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            color: #fff;
            font-size: 28px;
            font-weight: bold;
            text-decoration: none;
        }

        .search-box {
            flex: 0 0 40%;
            display: flex;
        }

        .search-box input {
            width: 100%;
            padding: 10px;
            border: none;
            border-radius: 4px 0 0 4px;
            outline: none;
        }

        .search-box button {
            padding: 10px 20px;
            background: #ff6666;
            border: none;
            color: white;
            border-radius: 0 4px 4px 0;
            cursor: pointer;
        }

        /* 轮播图 */
        .slider {
            position: relative;
            height: 400px;
            overflow: hidden;
        }

        .slide {
            position: absolute;
            width: 100%;
            height: 100%;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        .slide.active {
            opacity: 1;
        }

        .slide img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* 商品分类 */
        .categories {
            margin: 30px 0;
        }

        .section-title {
            font-size: 24px;
            color: #333;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #ff3c3c;
        }

        .category-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 20px;
        }

        .category-item {
            text-align: center;
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            transition: transform 0.3s ease;
        }

        .category-item:hover {
            transform: translateY(-5px);
        }

        .category-item i {
            font-size: 32px;
            color: #ff3c3c;
            margin-bottom: 10px;
        }

        /* 商品列表 */
        .products {
            margin: 30px 0;
        }

        .product-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
        }

        /* 商品卡片样式优化 */
        .product-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            transition: all 0.3s ease;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            position: relative;
        }

        .product-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        }

        .product-image {
            position: relative;
            height: 250px;
            overflow: hidden;
        }

        .product-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .product-card:hover .product-image img {
            transform: scale(1.05);
        }

        .product-info {
            padding: 20px;
            position: relative;
        }

        .product-title {
            font-size: 18px;
            margin-bottom: 10px;
            color: #333;
        }

        .price {
            display: flex;
            align-items: baseline;
            gap: 8px;
            margin-bottom: 15px;
            font-size: 20px;
            color: #ff3c3c;
            font-weight: bold;
        }

        .price small {
            color: #999;
            text-decoration: line-through;
            font-size: 14px;
        }

        .buy-btn {
            width: 100%;
            padding: 12px 0;
            background: linear-gradient(45deg, #ff3c3c, #ff6666);
            color: white;
            border: none;
            border-radius: 25px;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .buy-btn:hover {
            background: linear-gradient(45deg, #ff6666, #ff3c3c);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255,60,60,0.3);
        }

        /* 商品标签样式 */
        .product-tag {
            position: absolute;
            top: 10px;
            left: 10px;
            background: rgba(255,60,60,0.9);
            color: white;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 12px;
            font-weight: bold;
        }

        /* 商品评分样式 */
        .product-rating {
            display: flex;
            align-items: center;
            gap: 5px;
            margin-bottom: 10px;
            color: #ffa41c;
        }

        .rating-stars i {
            font-size: 14px;
        }

        .rating-count {
            color: #999;
            font-size: 12px;
        }

        /* 页脚 */
        .footer {
            background: #333;
            color: white;
            padding: 40px 0 20px;
        }

        .footer-content {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 30px;
        }

        .footer-section h3 {
            margin-bottom: 20px;
            color: #ff6666;
        }

        .footer-section ul {
            list-style: none;
        }

        .footer-section ul li {
            margin-bottom: 10px;
        }

        .footer-section ul li a {
            color: #ccc;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .footer-section ul li a:hover {
            color: #ff6666;
        }

        .footer-bottom {
            text-align: center;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #444;
        }

        /* 主导航栏样式优化 */
        .nav-content {
            display: flex;
            align-items: center;
            gap: 30px;
        }

        /* Logo样式优化 */
        .logo {
            color: #fff;
            font-size: 32px;
            font-weight: bold;
            text-decoration: none;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
            transition: transform 0.3s ease;
            padding: 5px 15px;
            border-radius: 8px;
            background: linear-gradient(45deg, #ff3c3c, #ff6666);
        }

        .logo:hover {
            transform: translateY(-2px);
        }

        /* 搜索框样式优化 */
        .search-box {
            flex: 0 0 45%;
            display: flex;
            position: relative;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            border-radius: 25px;
            overflow: hidden;
        }

        .search-box input {
            width: 100%;
            padding: 12px 20px;
            border: 2px solid transparent;
            border-radius: 25px 0 0 25px;
            font-size: 15px;
            transition: all 0.3s ease;
        }

        .search-box input:focus {
            border-color: #ff6666;
            outline: none;
        }

        .search-box button {
            padding: 12px 25px;
            background: linear-gradient(45deg, #ff6666, #ff3c3c);
            border: none;
            color: white;
            font-size: 15px;
            font-weight: 500;
            border-radius: 0 25px 25px 0;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .search-box button:hover {
            background: linear-gradient(45deg, #ff3c3c, #ff6666);
            box-shadow: 0 2px 8px rgba(255,60,60,0.3);
        }

        /* 购物车按钮样式优化 */
        .cart a {
            display: flex;
            align-items: center;
            gap: 8px;
            color: white;
            text-decoration: none;
            font-size: 16px;
            padding: 8px 15px;
            border-radius: 20px;
            background: rgba(255,255,255,0.1);
            transition: all 0.3s ease;
        }

        .cart a:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-2px);
        }

        .cart i {
            font-size: 18px;
        }

        /* 修改轮播图悬停效果 */
        .slide {
            cursor: pointer;
            transition: opacity 0.5s ease;
        }

        .slide:hover {
            opacity: 0.9;
        }

        .slide img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .slide:hover img {
            transform: scale(1.02);
        }
    </style>
</head>
<body>
    <!-- 主导航栏 -->
    <nav class="main-nav">
        <div class="container">
            <div class="nav-content">
                <a href="#" class="logo">��乐乐</a>
                <div class="search-box">
                    <input type="text" placeholder="搜索你喜欢的商品...">
                    <button>
                        <i class="fas fa-search"></i>
                        搜索
                    </button>
                </div>
                <div class="cart">
                    <a href="购物车.html">
                        <i class="fas fa-shopping-cart"></i>
                        购物车
                    </a>
                </div>
            </div>
        </div>
    </nav>

    <!-- 次要导航栏（原顶部导航） -->
    <div class="top-bar">
        <div class="container">
            <div class="top-bar-content">
                <div class="top-links">
                    <a href="登录界面.html">请登录</a>
                    <a href="注册界面.html">免费注册</a>
                </div>
                <div class="top-links">
                    <a href="个人中心.html"><i class="fas fa-user"></i> 我的淘乐乐</a>
                    <a href="购物车.html"><i class="fas fa-shopping-cart"></i> 购物车</a>
                    <a href="#"><i class="fas fa-heart"></i> 收藏夹</a>
                </div>
            </div>
        </div>
    </div>

    <!-- 轮播图 -->
    <div class="container">
        <div class="slider">
            <div class="slide active" onclick="location.href='双十二活动.html'" style="cursor: pointer;">
                <img src="images/1.jpg" alt="双十二活动">
            </div>
            <div class="slide" onclick="location.href='双十二活动.html'" style="cursor: pointer;">
                <img src="images/2.jpg" alt="新品上市">
            </div>
            <div class="slide" onclick="location.href='双十二活动.html'" style="cursor: pointer;">
                <img src="images/3.jpg" alt="特惠商品">
            </div>
            <div class="slide" onclick="location.href='双十二活动.html'" style="cursor: pointer;">
                <img src="images/4.jpg" alt="品牌活动">
            </div>
        </div>
    </div>

    <!-- 商品分类 -->
    <div class="container">
        <div class="categories">
            <h2 class="section-title">商品分类</h2>
            <div class="category-grid">
                <div class="category-item">
                    <i class="fas fa-mobile-alt"></i>
                    <h3>手机数码</h3>
                </div>
                <div class="category-item">
                    <i class="fas fa-tshirt"></i>
                    <h3>服装服饰</h3>
                </div>
                <div class="category-item">
                    <i class="fas fa-laptop"></i>
                    <h3>电脑办公</h3>
                </div>
                <div class="category-item">
                    <i class="fas fa-home"></i>
                    <h3>家居家装</h3>
                </div>
                <div class="category-item">
                    <i class="fas fa-utensils"></i>
                    <h3>食品生鲜</h3>
                </div>
            </div>
        </div>

        <!-- 商品列表 -->
        <div class="products">
            <h2 class="section-title">热门商品</h2>
            <div class="product-grid">
                <div class="product-card">
                    <div class="product-image">
                        <img src="images/5.jpg" alt="iPhone 14 Pro Max">
                        <span class="product-tag">热销</span>
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">iPhone 14 Pro Max</h3>
                        <div class="product-rating">
                            <div class="rating-stars">
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star-half-alt"></i>
                            </div>
                            <span class="rating-count">(2.5k)</span>
                        </div>
                        <div class="price">
                            ¥8999 <small>¥9999</small>
                        </div>
                        <button class="buy-btn" onclick="location.href='付款界面.html'">
                            <i class="fas fa-shopping-cart"></i>
                            立即购买
                        </button>
                    </div>
                </div>
                <!-- MacBook Pro 商品卡片 -->
                <div class="product-card">
                    <div class="product-image">
                        <img src="images/6.jpg" alt="MacBook Pro">
                        <span class="product-tag">新品</span>
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">MacBook Pro</h3>
                        <div class="product-rating">
                            <div class="rating-stars">
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                            </div>
                            <span class="rating-count">(1.8k)</span>
                        </div>
                        <div class="price">
                            ¥12999 <small>¥13999</small>
                        </div>
                        <button class="buy-btn" onclick="location.href='付款界面.html'">
                            <i class="fas fa-shopping-cart"></i>
                            立即购买
                        </button>
                    </div>
                </div>
                <!-- AirPods Pro 商品卡片 -->
                <div class="product-card">
                    <div class="product-image">
                        <img src="images/7.jpg" alt="AirPods Pro">
                        <span class="product-tag">促销</span>
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">AirPods Pro</h3>
                        <div class="product-rating">
                            <div class="rating-stars">
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="far fa-star"></i>
                            </div>
                            <span class="rating-count">(3.2k)</span>
                        </div>
                        <div class="price">
                            ¥1999 <small>¥2199</small>
                        </div>
                        <button class="buy-btn" onclick="location.href='付款界面.html'">
                            <i class="fas fa-shopping-cart"></i>
                            立即购买
                        </button>
                    </div>
                </div>
                <!-- iPad Air 商品卡片 -->
                <div class="product-card">
                    <div class="product-image">
                        <img src="images/8.jpg" alt="iPad Air">
                        <span class="product-tag">限时</span>
                    </div>
                    <div class="product-info">
                        <h3 class="product-title">iPad Air</h3>
                        <div class="product-rating">
                            <div class="rating-stars">
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star"></i>
                                <i class="fas fa-star-half-alt"></i>
                            </div>
                            <span class="rating-count">(1.5k)</span>
                        </div>
                        <div class="price">
                            ¥4999 <small>¥5499</small>
                        </div>
                        <button class="buy-btn" onclick="location.href='付款界面.html'">
                            <i class="fas fa-shopping-cart"></i>
                            立即购买
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>关于我们</h3>
                    <ul>
                        <li><a href="#">公司简介</a></li>
                        <li><a href="#">联系我们</a></li>
                        <li><a href="#">招贤纳士</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>客户服务</h3>
                    <ul>
                        <li><a href="#">帮助中心</a></li>
                        <li><a href="#">售后服务</a></li>
                        <li><a href="#">配送服务</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>支付方式</h3>
                    <ul>
                        <li><a href="#">在线支付</a></li>
                        <li><a href="#">货到付款</a></li>
                        <li><a href="#">分期付款</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>关注我们</h3>
                    <ul>
                        <li><a href="#"><i class="fab fa-weixin"></i> 微信</a></li>
                        <li><a href="#"><i class="fab fa-weibo"></i> 微博</a></li>
                        <li><a href="#"><i class="fab fa-qq"></i> QQ</a></li>
                    </ul>
                </div>
            </div>
            <div class="footer-bottom">
                <p>© 2024 淘乐乐商城 版权所有</p>
            </div>
        </div>
    </footer>

    <script>
        // 轮播图功能
        const slides = document.querySelectorAll('.slide');
        let currentSlide = 0;

        function showSlide(n) {
            slides.forEach(slide => {
                slide.classList.remove('active');
                // 保持所有轮播图的点击效果
                slide.style.cursor = 'pointer';
                slide.onclick = () => location.href='双十二活动.html';
            });
            
            currentSlide = (n + slides.length) % slides.length;
            slides[currentSlide].classList.add('active');
        }

        function nextSlide() {
            showSlide(currentSlide + 1);
        }

        // 自动轮播
        setInterval(nextSlide, 3000);
        
        // 初始化轮播图
        showSlide(0);

        function addToCart(product) {
            let cartItems = JSON.parse(localStorage.getItem('cartItems')) || [];
            
            // 查找购物车中是否已存在该商品
            const existingItemIndex = cartItems.findIndex(item => 
                item.name === product.name && 
                item.specs === product.specs
            );

            if (existingItemIndex !== -1) {
                // 如果商品已存在，增加数量
                cartItems[existingItemIndex].quantity += 1;
                alert('商品数量+1！');
            } else {
                // 如果商品不存在，添加新商品
                cartItems.push(product);
                alert('添加成功！');
            }

            localStorage.setItem('cartItems', JSON.stringify(cartItems));
        }
    </script>
</body>
</html> 